<template>
  <MainLayout>
    <template #header>
      <div class="flex_block header_modal" @click="handleBack">
        <!-- <el-icon class="title icon"><ArrowLeftBold /></el-icon> -->
        <div class="title">{{ title }}</div>
      </div>
    </template>
    <template #main>
      <div class="main_block" v-loading="loading">
        <iframe :src="record_url" class="iframe_block" style=""></iframe>
      </div>
    </template>
  </MainLayout>
</template>

<script setup >
import { nextTick, onBeforeUnmount, onMounted, ref } from "vue";
import { GetTestDetailReport, CloseOutReport } from "@/api/test_case";
const router = useRouter();
const route = useRoute();
const loading = ref(true);
const record_url = ref("");
const record_item = ref(false);
const title = ref('报告详情')

watch(()=>route,()=>{
  console.log("route", route);
  if (route.query.url) {
    record_url.value = route.query.url;
    title.value = route.query.title
    loading.value = false;
  } else {
    handleBack();
    return ElMessage.error("请从正确位置进入该页面");
  }
},{immediate:true, deep:true})

onMounted(() => {
  
});
// 如果是true就代表 报告已经生成了，退出的时候需要结束进程
onBeforeUnmount(() => {
});
// 返回
const handleBack = () => {
  router.back();
};
</script>
<style scoped lang="scss">
.header_modal {
  width: 100%;
  align-items: center;
  cursor: pointer;
  .title {
    margin-top: -6px;
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 18px;
  }
}
.main_block {
  height: 100%;
  width: 100%;
  // overflow-y: scroll;
}
.iframe_block {
  width: calc(100vw - 220px);
  height: 99%;
  border: none;
  overflow-y: scroll;
}
:deep(.ant-drawer-content-wrapper) {
  width: 100% !important;
}
</style>